<?php
/*========================================= JooSam =========================================/
/																							/
/	Extention:		JooSam																	/
/	Created by:		Broadcastweb.eu - Paules												/
/	Site:			http://www.broadcastweb.eu												/
/	Email:			support@broadcastweb.eu													/
/	Copyright:		2011 - 2012 (c) Broadcastweb.eu											/
/	License:		CC BY-NC-ND 3.0 ~ http://creativecommons.org/licenses/by-nc-nd/3.0/		/
/	File Version:	0003																	/
/																							/
/========================================== JooSam ========================================*/
// Joomla security
defined('_JEXEC') or die;

jimport('joomla.application.component.view');

class JooSamViewSonglist extends JView{

	// Display function
	function display($tpl = null){

		$jsm_helper = new JooSamHelper();
		$request_help = new RequestHelper();
		$samdb = new samdbo();
		$params = $jsm_helper->Params();
		$settings = $jsm_helper->config();
		$getData = new jsm_get();
		$thanksMSG = $request_help->sendMessage();

		// Load Joomla errors/messages
		if (count($errors = $this->get('Errors'))){
			JError::raiseError(500, implode('<br />', $errors));
			return false;
		}

		$this->params = $params;
		$this->settings = $settings;
		$this->samdb = $samdb;
		$this->getdata = $getData;
		$this->thanksmsg = $thanksMSG;
		//$params->default_textcolor = $params->get('txt_default_color');

		// Load data
		$this->setDocument();
		parent::display($tpl);
		//$samdb->close();
	}

	protected function setDocument(){
		
		$params = JooSamHelper::Params();
		$document = JFactory::getDocument();
		//print_r($params);
		if($params->search->display == 'block'){
			$letter_padding = '25px 0 0 0';
		} else{
			$letter_padding = '0';
		}
		$document->addStyleDeclaration('
			.jsm_content{
				width:'.$params->global->width.';
				margin:0;
			}
			.jsm_header{
				border:'.$params->header->border.';
				border-radius:'.$params->header->border_radius.';
				background:'.$params->header->background.';
				padding:6px;
				margin:0 0 6px 0;
			}
			.jsm_body{
				border:'.$params->body->border.';
				border-radius:'.$params->body->border_radius.';
				background:'.$params->body->background.';
				padding:6px;
				min-height:200px;
			}
			.jsm_search{
				float:'.$params->search->float.';
				margin:0;
				padding:0;
			}
			#jsm_search_letter{
				padding:'.$letter_padding.';
				width:100%;
			}
			.jsm_pagenation{
				padding: 1px 6px;
				background-color:buttonface;
				border: 2px outset buttonface;
				border-radius: 6px;
				color: buttontext;
				margin:5px 0 0 0;
			}
			.jsm_pageselet{
				margin: 0 6px;
				padding: 1px 6px;
				border: 1px solid #000000;
				border-radius: 6px;
			}
			.jsm_pagePrev,
			.jsm_pageNext{
				margin:0;
			}
			.pageGo{
				cursor:pointer;
				min-width:3px;
				padding:0 2px;
				text-align:center;
				margin:0;
			}
			.pageGo:hover{
				background:#beb6b8;
			}
			.pages{
				width:100%;
				text-align:center;
			}
			.jsm_row0{
				background:'.$params->table->row0_bg.';
			}
			.jsm_row1{
				background:'.$params->table->row1_bg.';
			}
			.jsm_tableTitle{
				color:'.$params->table->title_color.';
			}
			.jsm_tableArtist{
				color:'.$params->table->artist_color.';
			}
			.jsm_table{
				width:100%;
			}
			.jsm_ranking{
				width:90px;
			}
			.jsm_buttontd_1{
				width:90px;
			}
			.jsm_buttontd_2{
				width:135px;
			}
			.jsm_buttontd_3{
				width:180px;
			}
			.jsm_button{
				margin:0;
				padding:0 2px;
				min-width:15px;
			}
			.jsm_button:hover{
				cursor:pointer;
			}
		');
	}
}